/*
 * @Description: 
 * @Author: ljy
 * @Date: 2021-12-07 22:08:23
 * @LastEditors: ljy
 * @LastEditTime: 2021-12-13 21:05:35
 */
var express = require('express');
var router = express.Router();

const { findAll, pageQuery } = require('../../db/users/dts_user')

router.get('/user', function(req, res, next) {
    findAll((result) => {
        res.send(result);
        // console.log(result);
    })
})


router.get('/pageQuery', function(req, res, next) {
    try {
        let obj = {}
        const limit = parseInt(req.query.pageSize)
        const offset = parseInt((Number(req.query.pageNum) - 1) * Number(req.query.pageSize))
        pageQuery({ limit, offset, username: req.query.username, mobile: req.query.mobile }, (result) => {
            console.log(result, "result");
            res.send(result)
        })
    } catch (error) {
        console.log("error");
        res.send(error)
    }
});
module.exports = router;